import Request  from "@/Request";

// 注册传入数据
interface Register_data{
    associationName:string,
    phone:string,
    password:string,
    email:string,
    code:string
}

// 登录传入数据
interface Login_data{
    username:string,
    password:string
}
class UserRequest extends Request{
    // 注册函数
    public Register(data:Register_data){
        return this.post("/User/registeredAssociation",data);
    }

    //登录函数
    public Login(data:Login_data){
        return this.post('/login',data);
    }
    
    // 通过token获取用户信息
    public getUserInfo(){
        return this.post('/User/getInformation')
    }
    // 发送验证码
    public send(email:string){
        return this.post('/User/getCode',{email:email})
    }
    
    //通过社团id获取信息
    public getAssociation(id:number){
        return this.post('/Association/selectById',{id:id})
    }
    
    // 通过部门id获取信息
    public getDepartment(id:number){
        return this.post('/Association/selectDepartmentById',{id:id})
    }

}

export const userRequest=new UserRequest();